function logea()
{
    var divTrans = document.createElement("div");
    divTrans.setAttribute("id", "divTrans");
    divTrans.setAttribute("class", "fondoPopUp");

    var login = document.createElement("div");
    login.setAttribute("id", "login");
    login.setAttribute("class", "popupWrapper");

    var divHead = document.createElement("div");
    divHead.setAttribute("class", "divHead");

    var title = document.createElement("div");
    title.setAttribute("class", "divHead1");

    var span = document.createElement("p");
    span.setAttribute("id", "spanp");
    span.innerHTML = "<b>Ingresar</b>";
    title.appendChild(span);
    divHead.appendChild(title);

    var close = document.createElement("div");
    close.setAttribute("class", "divHead2");
    var imgclose = document.createElement("img");
    imgclose.setAttribute("src", "imagenes/close.png");
    imgclose.setAttribute("id", "imgClose");
    imgclose.setAttribute("class", "closeWin");
    imgclose.setAttribute("onclick", "hdte(event)");
    close.appendChild(imgclose);
    divHead.appendChild(close);

    login.appendChild(divHead);

    var line = document.createElement("hr");
    login.appendChild(line);

    var divPrin = document.createElement("div");
    divPrin.setAttribute("id", "loginDivPrin");

    var formLog = document.createElement("div");
    formLog.setAttribute("id", "formLog");
    formLog.setAttribute("method", "post");

    var form = document.createElement("form");
    form.setAttribute("id", "formLogin");

/////////////////////////////////////////////////////////////////////

    var div1 = document.createElement("div");
    div1.setAttribute("class", "loginBody");
        
    var div2 = document.createElement("div");
    div2.setAttribute("class", "loginBody");
    
    var div3 = document.createElement("div");
    div3.setAttribute("class", "loginBody");

    var span1 = document.createElement("p");
    span1.setAttribute("class", "span");
    span1.setAttribute("id", "spanNombUs");
    span1.innerHTML = "Nombre de Usuario";
    div1.appendChild(span1);
    
    var span3 = document.createElement("p");
    span3.setAttribute("class", "span");
    span3.setAttribute("id", "spanContUs");
    span3.innerHTML = "Contraseña";
    div1.appendChild(span3);

    var input = document.createElement("input");
    input.setAttribute("id", "user");
    input.setAttribute("placeholder", "Usuario");
    input.setAttribute("class", "inputsL");
    input.setAttribute("name", "user");
    input.setAttribute("tabindex", "1");
    div2.appendChild(input);

    var input2 = document.createElement("input");
    input2.setAttribute("id", "pw");
    input2.setAttribute("type", "password");
    input2.setAttribute("placeholder", "Contraseña");
    input2.setAttribute("class", "inputsL");
    input2.setAttribute("name", "pw");
    input2.setAttribute("tabindex", "2");
    div2.appendChild(input2);

    var span2 = document.createElement("p");
    span2.setAttribute("class", "span2");
    span2.setAttribute("id", "spanRegUs");
    span2.innerHTML = "<a id = 'regspan' onclick = 'registroEvent()'>¡Regístrese aquí!</a>";
    div3.appendChild(span2);
    
    var span4 = document.createElement("p");
    span4.setAttribute("class", "span2");
    span4.setAttribute("id", "spanOlvCont");
    span4.innerHTML = "<a href = '#' onclick = 'contrasenaEvent()'>¿Olvidaste tu contraseña?</a>";
    div3.appendChild(span4);

    form.appendChild(div1);
    form.appendChild(div2);
    form.appendChild(div3);

/////////////////////////////////////////////////////////////////////
    formLog.appendChild(form);
    divPrin.appendChild(formLog);
    creaBotonesSolicitud1(form);

    login.appendChild(divPrin);

    document.getElementById("subAlterno").appendChild(divTrans);
    document.getElementById("subAlterno").appendChild(login);

    var div = $('#login');
    div.css({
        'left': ($(window).width() / 2 - $(div).width() / 2) + 'px',
        'top': ($(window).height() / 2 - $(div).height() / 2) + 'px'
    });

    asignarListener();

    $("#login").fadeIn();
    document.getElementById("user").focus();
}

function creaBotonesSolicitud1(div)
{
    var bot = document.createElement("input");
    bot.type = "submit";
    bot.value = "Ingresar";
    bot.setAttribute("class", "botL");
    bot.setAttribute("tabindex", "3");
    bot.id = "botLA";
    bot.name = "botLA";
    div.appendChild(bot);
}